import streamlit as st
import importlib.util

# 设置页面配置
st.set_page_config(
    page_title="高分SAR图像 识别飞机",
    page_icon="✈️",
    layout="wide",
    initial_sidebar_state="expanded"
)

# 导航栏
st.sidebar.title("导航")
pages = {
    "项目介绍": "01_home",
    "单SAR图识别v1": "02_detection_v1",
    "多SAR图识别v1": "02_detection_batch_v1",
    "单SAR图识别v2": "02_detection_v2",
    "多SAR图识别v2": "02_detection_batch_v2",
    "性能评估": "03_performance",
    "关于我们": "04_about",
    # "参数配置": "05_model_params"
}

# 选择页面
selected_page = st.sidebar.radio("Go to", options=list(pages.keys()))
if selected_page:
    page_module = pages[selected_page]
    spec = importlib.util.spec_from_file_location(page_module, f"{page_module}.py")
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    module.main()